home *** CD-ROM | disk | FTP | other *** search
/ Assassins - Ultimate CD Games Collection 2 / Assassins 2 - Ultimate Games No. 2 (1995)(Weird Science)[!][Amiga-CD32-CDTV].iso / dnet / servers.doc < prev    next >
Text File  |  1994-02-11  |  1KB  |  38 lines

  1.  
  2.             HOW TO WRITE SERVER PROGRAMS
  3.  
  4. SERVERS are run on demand by the DNET device driver.    This is
  5. accomplished by DNET doing a LoadSeg() and CreatProc().  The server
  6. CANNOT GO THROUGH A NORMAL STARTUP for several reasons:
  7.  
  8.     (1) There is no CLI and the message passed over the process
  9.         port is DNET specific (NOT a workbench message)
  10.  
  11.     (2) Registers contain garbage (no argument line)
  12.  
  13.     (3) No standard file handles exist
  14.  
  15.  
  16. For AZTEC C, this is accomplished by overiding the standard _main with
  17. your own.  You must then setup the listen port and wait/reply the startup
  18. message from DNET.  See the source (for example, SERVER/STERM.C) for
  19. an example.
  20.  
  21. The server can exit at any time after it DUnListen()'s the port.  Multiple
  22. DNET's will all use the same server for a specific port #.
  23.  
  24. _main()
  25. {
  26.     struct Message *msg;
  27.     long mask, pmask, hdmask;
  28.     PROC *proc = FindTask(NULL);
  29.  
  30.     Enable_Abort = 0;
  31.     LisPort= DListen(PORT_IALPHATERM);
  32.     WaitPort(&proc->pr_MsgPort);
  33.     ReplyMsg(GetMsg(&proc->pr_MsgPort));
  34.     if (!LisPort)
  35.     exit(1);
  36.  
  37.         ...
  38.